package game.view.cooking
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.text.TextField;
	import game.UIComponent.Button;
	import game.UIComponent.Panel;
	import game.UIComponent.TabButton;
	import game.common.CustomBitmap;
	import game.common.Reflection;
	import game.managers.LanguageManager;
	import game.utils.Utils;
	public class CookingMenu  extends Panel
	{
		private var _cooktitle:TextField;
		private var _quanbu:TabButton;
		private var _yuecai:TabButton;
		private var _chuancai:TabButton;
		public function CookingMenu()
		{
			init();
		}
		
		override protected function init():void
		{
		
			setBgImage("learnPanel",543,446);
			setCenter();			
			close=new Point(500,50);
			
			
			
			_cooktitle=Utils.getCommonTextField(LanguageManager.getWord("cook.title"),15,110,115);
			addChild(_cooktitle);
			
			
			_quanbu=new TabButton(LanguageManager.getWord("cook.quanbu"),clickHandler,"tabBg");
			_quanbu.x=45;
			_quanbu.y=_cooktitle.y+_cooktitle.height+45;	
			_now=_quanbu;
			_quanbu.choose=true;
			addChild(_quanbu);
			
			_yuecai=new TabButton(LanguageManager.getWord("cook.yuecai"),clickHandler,"tabBg");
			_yuecai.x=_quanbu.x+_quanbu.width;
			_yuecai.y=_cooktitle.y+_cooktitle.height+45;	
			addChild(_yuecai);
			
			_chuancai=new TabButton(LanguageManager.getWord("cook.chuancai"),clickHandler,"tabBg");
			_chuancai.x=_yuecai.x+_yuecai.width;
			_chuancai.y=_cooktitle.y+_cooktitle.height+45;	
			addChild(_chuancai);
			
			this.addEventListener(MouseEvent.MOUSE_DOWN,act1_mc);
			this.addEventListener(MouseEvent.MOUSE_UP,act2_mc);
			
		}
		
		private function act1_mc(evt:MouseEvent):void
		{
			if(mouseX>150&&mouseX<400&&mouseY>-100&&mouseY<100)
			{
				this.startDrag();
			}
			
		}
		private function act2_mc(evt:MouseEvent):void
		{
			this.stopDrag();
		}
		
		
		private var _now:TabButton;
		
		private function clickHandler(e:MouseEvent):void
		{
			var btn:TabButton = e.target as TabButton;
			if(btn == _now) return;
			if(_now)_now.choose = false;
			btn.choose = true;
			_now = btn;
			
			switch(btn){
				case _quanbu:
					break;
				case _yuecai:
					break;
				case _chuancai:
					break;
			}
		}
		
		
	}
}